<template>
	<view class="resume content">
		<!-- <telly-picker :value="value" :range="[array]" :rangekey="rangekey" placeholderText="请选择" @confirm="confirm"></telly-picker> -->
		
		<view class="list flex_r_between">
			<view class="left">
				<view class="circle flex_r_around">
					<text></text>
				</view>
				<view class="title">姓名</view>
			</view>
			<view class="right flex_1 flex_r_around">
				<input type="text" placeholder="请输入姓名" v-model="info.name">
			</view>
		</view>
		
		<view class="list flex_r_between">
			<view class="left">
				<view class="circle flex_r_around">
					<text></text>
				</view>
				<view class="title">手机号</view>
			</view>
			<view class="right flex_1 flex_r_around">
				<input type="text" placeholder="请输入手机号" v-model="info.mobile">
			</view>
		</view>
		

		<view class="btn" @click="submit" v-if="status == 0">提交</view>
		<view class="btn" v-else-if="status == 1">审核中</view>
		<view class="btn" @click="submit"  v-else-if="status == 3">审核失败，请重新提交</view>
		<view class="btn" @click="$util.toUrl('/technician/index/index')" v-else>已通过</view>

	</view>
</template>

<script>
	import AddressPicker from "@/components/lingdang-AddressPicker/AddressPicker.vue"
	export default {
		components: {
			AddressPicker
		},
		data() {
			return {
				info:{
					mobile:'',
					name:'',
				},

				flag: true,
				
				status:0,
			}
		},
		methods: {
			submit() {
				if(!this.info.name){return this.$util.msg('请先填写姓名')}
				if(!this.info.mobile){return this.$util.msg('请先填写手机号')}
				if (!this.flag) {
					return
				}
				this.flag = false
				this.request.httpTokenRequest({
					url: "/index/applyTechnician",
					method: "post"
				}, this.info).then(data => {
					this.flag = true
					this.$util.msg(data.msg)
					if (data.code == 0) {
						// uni.navigateTo({
						// 	url: '/technician/info/service'
						// })
						this.getAuth()
					}
				}, error => {})
			},
			
			getAuth() {
				this.request.httpTokenRequest({
					url: "/index/applyTechnician",
					method: "get"
				}).then(data => {
					if(data.data.status){
						this.status = data.data.status
						this.info.mobile = data.data.mobile
						this.info.name = data.data.name
					}else {
						this.status = 0
					}
				}, error => {})
			},

		},
		onLoad() {
			this.getAuth()
		},
	}
</script>

<style lang="scss" scoped>
	.resume {
		padding: 30rpx 30rpx 120rpx 0;
	}

	.flex_1 {
		flex: 1;
	}

	.list {
		padding: 30rpx;
		background: #FFF;
		border-radius: 12rpx;
		margin: 15rpx 0;

		.left {
			display: flex;
			align-items: center;

			.circle {
				width: 40rpx;
				height: 40rpx;
				background: #F5F7F8;
				border-radius: 50%;
				margin-right: 10rpx;

				text {
					width: 10rpx;
					height: 10rpx;
					background: #B9D2F8;
					border-radius: 50%;
				}
			}
		}

		.right {
			display: flex;
			align-items: center;

			input {
				font-size: 28rpx;
				text-align: right;
				flex: 1;
			}

			.text {
				color: rgb(143, 143, 143);
				font-size: 28rpx;
				margin-left: 20rpx;
			}
		}
	}
	.btn {
		width: 690rpx;
		height: 88rpx;
		background: #2E7EFA;
		border-radius: 44rpx;
		margin-top: 30rpx;
		font-size: 34rpx;
		color: #FFFFFF;
		line-height: 88rpx;
		text-align: center;
		position: fixed;
		bottom: 10rpx;
		left: 50%;
		transform: translateX(-50%);
	}
</style>